% Zhejiang University Graduation Thesis/Design Template
% Author    : Zixuan Wang
% Email     : zxwang42 [at] gmail.com
% Update    : https://github.com/TheNetAdmin/zjuthesis/releases
% Chat Room : https://gitter.im/zjuthesis/community
% Document  : https://thenetadmin.github.io/zjuthesis
\documentclass[
    StudentName     = 魏耀东,
    StudentID       = 3160105062,
    AdvisorName     = 袁昕,
    Grade           = 2020,            % only the year, no '级'
    Major           = 求是科学班（计算机）,
    Department      = 计算机科学与技术学院,
    Title           = Windows 下 websocket 程序框架设计,
    SubmitDate      = 2020 年 5 月 27 日,
    MajorFormat     = general,
    Degree          = undergraduate,   % 'undergraduate' or 'graduate'
    Type            = design,          % 'thesis'   or 'design'
    Period          = final,           % 'proposal' or 'final'
    BlindReview     = false,           % 'false'    or 'true'
    Language        = chinese,         % 'chinese'  or 'english'
    % Below only for 'graduate'
    GradLevel       = master,          % 'master' or 'doctor'
    Topic           = 研究方向,
    ColaboratorName = 合作导师,
    TitleEng        = {{Graduation Thesis Title}}
]{./config/zjuthesis}  

\newcommand{\inputundergraduate}
{
    \ifthenelse{\equal{\Period}{final}}
    {
        % Final thesis
        % Final part
        \newcommand{\undergradcurrstage}{final}
        \newrefsection
        
        \coverstyle
        \inputpage{final/cover}
 
        \prevstyle
        \inputpage{final/previous}
        \inputpage{final/toc}

        \bodystyle
        \cleardoublepage
        \ifthenelse{\equal{\Type}{design}}
            {\part{毕业设计}}
            {\part{毕业论文}}
        
        \inputbody{final/content}

        \poststyle
        \inputpage{final/post}

        % Proposal part
        \renewcommand{\undergradcurrstage}{proposal}
        \newrefsection

        \coverstyle
        \cleardoublepage
        \ifthenelse{\equal{\Type}{design}}
            {\part{毕业设计开题报告}}
            {\part{毕业论文开题报告}}

        \inputpage{proposal/cover}
        \inputpage{proposal/previous}
        
        \bodystyle
        \inputbody{proposal/content}

        \poststyle
        \inputpage{proposal/post}
    }
    {
        % Thesis proposal
        \newcommand{\undergradcurrstage}{proposal}

        \coverstyle
        \inputpage{proposal/cover}
    
        % 'proposal' previous part uses 'empty' page style,
        % as shown in cs undergrad template.
        \inputpage{proposal/previous}
        
        \prevstyle
        \inputpage{proposal/toc}
    
        \bodystyle
        \inputbody{proposal/content}
        
        \poststyle
        \inputpage{proposal/post}
    }
}

\newcommand{\inputgraduate}
{
    \coverstyle
    \inputpage{cover}

    \prevstyle
    \inputpage{previous}
    \inputpage{toc}
    
    % Main contents
    \bodystyle
    \inputbody{content}

    % Post part
    \poststyle
    \inputbody{post}
}

\begin{document}

\ifthenelse{\equal{\Degree}{undergraduate}}
{
    \inputundergraduate{}
}
{
    \inputgraduate{}
}
\end{document}
